package org.git.movie.controller;

import com.alibaba.csp.sentinel.EntryType;
import com.alibaba.csp.sentinel.annotation.SentinelResource;
import lombok.extern.slf4j.Slf4j;
import org.git.movie.annotations.Verify;
import org.git.movie.form.VodSiteForm;
import org.git.movie.service.IVodSiteService;
import org.git.movie.util.BaseController;
import org.git.movie.util.BaseResponse;
import org.git.movie.vo.PageDto;
import org.git.movie.vo.VodSiteDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;


/**
 * @author sqyc
 */
@Controller
@RequestMapping("vodsite")
@Slf4j
public class VodSiteController extends BaseController {

    @Autowired
    private IVodSiteService vodSiteService;

//    @SentinelResource(value = "vodsiteFindPage" ,entryType = EntryType.IN)
    @ResponseBody
    @RequestMapping(value = "/findpage.do", method = {RequestMethod.POST,RequestMethod.GET})
    public BaseResponse<PageDto<VodSiteDto>>   vodsite_findpage(
              VodSiteForm vodSiteForm ,
            @Verify(param="pageNo",rule="required|min(1)") int pageNo,
                                                @Verify(param="pageSize",rule="required|min(3)|max(60)") int pageSize) {

        PageDto<VodSiteDto> page = vodSiteService.findVodSitePage(vodSiteForm,pageNo,pageSize);
        return   ok(page);
    }
}
